CREATE TABLE [dbo].[tb_Servicios]
(
[idServicio] [int] NOT NULL IDENTITY(1, 1),
[Edificio] [int] NOT NULL,
[TipoServicio] [int] NOT NULL,
[Descripcion] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Prestatario] [int] NOT NULL,
[NumeroDeCliente] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CosumoPromMensual] [int] NULL,
[UnidadDeMedida] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CostoPromMensual] [int] NULL,
[Financiamiento] [int] NOT NULL,
[PartidaPresupuestaria] [int] NULL,
[FormaDePago] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tb_Servicios] ADD CONSTRAINT [PK_tb_Servicios] PRIMARY KEY NONCLUSTERED  ([idServicio]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [idxServicioEdificio] ON [dbo].[tb_Servicios] ([Edificio]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tb_Servicios] WITH NOCHECK ADD CONSTRAINT [FK_tb_Servicios_tb_Edificios] FOREIGN KEY ([Edificio]) REFERENCES [dbo].[tb_Edificios] ([idEdificio]) NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[tb_Servicios] WITH NOCHECK ADD CONSTRAINT [FK_tb_Servicios_tb_FuentesDeFinanciamiento] FOREIGN KEY ([Financiamiento]) REFERENCES [dbo].[tb_FuentesDeFinanciamiento] ([idFuenteFinanciamiento]) NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[tb_Servicios] WITH NOCHECK ADD CONSTRAINT [FK_tb_Servicios_tb_PartidasPresupuestarias] FOREIGN KEY ([PartidaPresupuestaria]) REFERENCES [dbo].[tb_PartidasPresupuestarias] ([idPartida])
GO
ALTER TABLE [dbo].[tb_Servicios] WITH NOCHECK ADD CONSTRAINT [FK_tb_Servicios_tb_PrestadoresDeServicio] FOREIGN KEY ([Prestatario]) REFERENCES [dbo].[tb_PrestadoresDeServicio] ([idPrestadorDeServicio]) NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[tb_Servicios] WITH NOCHECK ADD CONSTRAINT [FK_tb_Servicios_tb_TiposDeServicios] FOREIGN KEY ([TipoServicio]) REFERENCES [dbo].[tb_TiposDeServicios] ([idTipoDeServicio])
GO
ALTER TABLE [dbo].[tb_Servicios] NOCHECK CONSTRAINT [FK_tb_Servicios_tb_Edificios]
GO
ALTER TABLE [dbo].[tb_Servicios] NOCHECK CONSTRAINT [FK_tb_Servicios_tb_FuentesDeFinanciamiento]
GO
ALTER TABLE [dbo].[tb_Servicios] NOCHECK CONSTRAINT [FK_tb_Servicios_tb_PrestadoresDeServicio]
GO
